#pragma once

#include <gofcl_timer_chctl2.h>

typedef struct {
	u16_s channel_0_en : 1;
	u16_s channel_0_polarity_neg : 1;
	u16_s channel_0_complementary_en : 1;
	u16_s channel_0_complementary_polarity_neg : 1;
	u16_s channel_1_en : 1;
	u16_s channel_1_polarity_neg : 1;
	u16_s channel_1_complementary_en : 1;
	u16_s channel_1_complementary_polarity_neg : 1;
	u16_s channel_2_en : 1;
	u16_s channel_2_polarity_neg : 1;
	u16_s channel_2_complementary_en : 1;
	u16_s channel_2_complementary_polarity_neg : 1;
	u16_s channel_3_en : 1;
	u16_s channel_3_polarity_neg : 1;
	u16_s : 2;
} timer_chctl2_expl_s;

_Static_assert(sizeof(timer_chctl2_expl_s) == 2,
	       "Struct timer_chctl2_exp_s defined error!");

static inline void timer_channel_setup_2(timer_qe timer_q,
					 timer_chctl2_expl_s chctl2) {
	union {
		timer_chctl2_expl_s e;
		timer_chctl2_s c;
	} cu = {
		.e = chctl2,
	};
	timer_wreg_chctl2_s(timer_q, cu.c);
}
